<style lang="less" scoped>
  .treatment-process{
    width: 100%;
    height: 100%;
    &_content{
      height: calc(100% - 119px);
      overflow-y: auto;
    }
    .dignosis-content{
      width: 100%;
      height: 400px;
      display: inline-block;
      .dignosis-style{
        display: inline-block;
        width: 50%;
        height: 100%;
      }
    }
    .box-card + .box-card{
      margin-top: 5px;
    }
    /deep/.el-radio__label{
      line-height: 38px;
    }
  }
</style>

<template>
  <div class="treatment-process">
    <!-- <el-form inline>
      <el-radio v-model="radioDate" label="1" @change="changeDate">
        <span style="margin-right: 5px;">指定日期</span>
        <el-form-item label="年份：">
          <el-date-picker
            v-model="year"
            type="year"
            value-format="yyyy"
            size="mini"
            :disabled="radioDate == 2"
            placeholder="选择年"
          />
        </el-form-item>
        <el-form-item label="季度：">
          <el-select v-model="quarter" size="mini" placeholder="请选择" :disabled="radioDate == 2">
            <el-option label="第一季度" :value="1" />
            <el-option label="第二季度" :value="2" />
            <el-option label="第三季度" :value="3" />
            <el-option label="第四季度" :value="4" />
          </el-select>
        </el-form-item>
        <el-form-item label="月份：">
          <el-select v-model="month" size="mini" placeholder="请选择" :disabled="radioDate == 2">
            <el-option label="一月" :value="1" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="二月" :value="2" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="三月" :value="3" :disabled="quarter != '' && quarter != '1'" />
            <el-option label="四月" :value="4" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="五月" :value="5" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="六月" :value="6" :disabled="quarter != '' && quarter != '2'" />
            <el-option label="七月" :value="7" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="八月" :value="8" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="九月" :value="9" :disabled="quarter != '' && quarter != '3'" />
            <el-option label="十月" :value="10" :disabled="quarter != '' && quarter != '4'" />
            <el-option label="十一月" :value="11" :disabled="quarter != '' && quarter != '4'" />
            <el-option label="十二月" :value="12" :disabled="quarter != '' && quarter != '4'" />
          </el-select>
        </el-form-item>
      </el-radio>
      <el-radio v-model="radioDate" label="2" @change="changeDate">
        <span style="margin-right: 5px;">其他时间</span>
        <el-form-item label="">
          <el-date-picker
            v-model="monthRange"
            type="monthrange"
            start-placeholder="开始月份"
            end-placeholder="结束月份"
            size="mini"
            format="yyyy-MM"
            value-format="yyyy-MM"
            :disabled="radioDate == 1"
          />
        </el-form-item>
      </el-radio>
      <el-form-item label="科室：">
        <el-select v-model="dept" placeholder="请选择" size="mini" @change="deptChange">
          <el-option
            v-for="(item, index) in deptList"
            :key="index"
            :label="item.name"
            :value="item.name"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="人员：">
        <el-select v-model="doc" placeholder="请选择" size="mini">
          <el-option
            v-for="(item, index) in docList"
            :key="index"
            :label="item.name"
            :value="item.name"
          />
        </el-select>
      </el-form-item>
      <el-form-item label="">
        <el-button type="primary" size="mini" @click="search">搜索</el-button>
        <el-button size="mini" @click="reset">重置</el-button>
      </el-form-item>
    </el-form> -->
    <div class="treatment-process_content">
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>诊断类型分布情况统计</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>“初步诊断”已填写的病例</div>
            <div>数据取值：</div>
            <div>1.全部病例“初步诊断”的类型分布和占比情况</div>
            <div>2.总数=各诊断类型数量，每类数量/总数=该类占比</div>
            <div>3.其中非ACS心源性胸痛、其它非心源性胸痛、胸痛待查、胸闷待查、未明确诊断划分到“其他”，以右侧小图详细展示</div>
            <div>4.按月统计，1个病例计为1例，无重复计算</div>
            <div>查询筛选：</div>
            <div>时间、全院、科室、人员</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div class="dignosis-content">
          <div id="diagnosis-type" class="dignosis-style" />
          <div id="other-diagnosis-type" class="dignosis-style" />
        </div>
      </el-card>
      <el-card v-if="isShowDept" class="box-card">
        <div slot="header" class="clearfix">
          <span>{{ doc ? '个人接诊数量统计' : '科室接诊数量统计' }}</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>“初步诊断”已填写的病例</div>
            <div>数据取值：</div>
            <div>1.取建档数据</div>
            <div>2.其中非ACS心源性胸痛、其它非心源性胸痛、胸痛待查、胸闷待查、未明确诊断划分到“其他”</div>
            <div>3.按月统计，无重复计算</div>
            <div>查询筛选：</div>
            <div>时间、科室、人员</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div id="dept-admissions" class="dignosis-content" />
      </el-card>
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>技术开展例数及占比</span>
        </div>
        <div v-show="!doc && !dept" class="dignosis-content" style="position: relative;">
          <div style="position: absolute; left: 47%; top: -1%;line-height: 36px; z-index: 999;">
            <div style="height: 20px; line-height: 20px; font-weight: bold; font-size: 20px; display: inline-block;">
              溶栓例数(全院)<span style="color: #666; font-size: 16px;">{{ '（总计：' + thrombolysisCasesTotal + '例）' }}</span>
            </div>
            <el-popover
              placement="bottom"
              title="说明"
              width="400"
              trigger="hover"
            >
              <div>考核对象：</div>
              <div>施行院前或院内溶栓的STEMI、肺动脉栓塞病例</div>
              <div>数据取值：</div>
              <div>1.分为院前溶栓、院内溶栓</div>
              <div>2.按月统计，全院的溶栓例数，1个病例计1例，无重复计算</div>
              <div>查询筛选：</div>
              <div>时间、全院</div>
              <i slot="reference" class="el-icon-info" style="color: #42cece;" />
            </el-popover>
          </div>
          <div id="thrombolysis-cases" style="width: 100%; height: 100%;" />
        </div>
        <div class="dignosis-content" style="position: relative;">
          <div style="position: absolute; left: 47%; top: -1%;line-height: 36px; z-index: 999;">
            <div style="height: 20px; line-height: 20px; font-weight: bold; font-size: 20px; display: inline-block;">
              院内溶栓治疗量分布图<span style="color: #666; font-size: 16px;">{{ '（总计：' + thrombolysisDistributionTotal + '例）' }}</span>
            </div>
            <el-popover
              placement="bottom"
              title="说明"
              width="400"
              trigger="hover"
            >
              <div>考核对象：</div>
              <div>施行院前或院内溶栓的STEMI、肺动脉栓塞病例</div>
              <div>数据取值：</div>
              <div>1.“院内溶栓场所”勾选“急诊科”</div>
              <div>2.按月统计，院内溶栓治疗量在急诊科的分布，1个病例1例，无重复计算</div>
              <div>查询筛选：</div>
              <div>时间、全院、科室</div>
              <i slot="reference" class="el-icon-info" style="color: #42cece;" />
            </el-popover>
          </div>
          <div id="thrombolysis-distribution" style="width: 100%; height: 100%;" />
        </div>
        <div class="dignosis-content" style="position: relative;">
          <div style="position: absolute; left: 47%; top: -1%;line-height: 36px; z-index: 999;">
            <div style="height: 20px; line-height: 20px; font-weight: bold; font-size: 20px; display: inline-block;">
              PCI不同操作的手术治疗量统计图<span style="color: #666; font-size: 16px;">{{ '（总计：' + pciOperationsTotal + '例）' }}</span>
            </div>
            <el-popover
              placement="bottom"
              title="说明"
              width="400"
              trigger="hover"
            >
              <div>考核对象：</div>
              <div>再灌注行PCI手术的STEMI病例</div>
              <div>数据取值：</div>
              <div>1.“术中处理”勾选“植入支架  PTCA  血栓抽吸  冠脉内溶栓”其中一项或多项</div>
              <div>2.按月统计，PCI手术不同操作的例数，1个病例计1例，无重复计算</div>
              <div>查询筛选：</div>
              <div>时间、全院、科室</div>
              <i slot="reference" class="el-icon-info" style="color: #42cece;" />
            </el-popover>
          </div>
          <div id="pci-operations" style="width: 100%; height: 100%;" />
        </div>
        <div v-if="!doc" class="dignosis-content" style="position: relative;">
          <div style="position: absolute; left: 47%; top: -1%;line-height: 36px; z-index: 999;">
            <div style="height: 20px; line-height: 20px; font-weight: bold; font-size: 20px; display: inline-block;">
              手术治疗量分布图<span style="color: #666; font-size: 16px;">{{ '（总计：' + surgicalTreatmentTotal + '例）' }}</span>
            </div>
            <el-popover
              placement="bottom"
              title="说明"
              width="400"
              trigger="hover"
            >
              <div>考核对象：</div>
              <div>再灌注行PCI手术的STEMI病例</div>
              <div>数据取值：</div>
              <div>1.“术中处理”勾选“植入支架  PTCA  血栓抽吸  冠脉内溶栓”其中一项或多项时，取“介入医师”姓名及所在科室</div>
              <div>2.按月统计，PCI不同手术治疗量分布，1个病例计1例，无重复计算</div>
              <div>查询筛选：</div>
              <div>时间、全院、科室</div>
              <i slot="reference" class="el-icon-info" style="color: #42cece;" />
            </el-popover>
          </div>
          <div v-if="!doc" id="surgical-treatment" style="width: 100%; height: 100%;" />
        </div>
      </el-card>
      <el-card v-show="!doc" class="box-card">
        <div slot="header" class="clearfix">
          <span>自行来院D2B平均时间排名</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>自行来院施行PCI手术的STEMI病例</div>
            <div>数据取值：</div>
            <div>1.入门至导丝通过时间的平均值；</div>
            <div>2.按月统计，1个病例计1例，无重复计算</div>
            <div>3.按月统计，无重复计算</div>
            <div>查询筛选：</div>
            <div>时间、全院、科室</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div id="d2b-average-time" class="dignosis-content" />
      </el-card>
      <el-card v-show="!doc" class="box-card">
        <div slot="header" class="clearfix">
          <span>自行来院D2B耗时最短病例（TOP5）</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>自行来院施行PCI手术的STEMI病例</div>
            <div>数据取值：</div>
            <div>1.入门至导丝通过时间最短耗时5个病例的排名，从短到长</div>
            <div>2.显示接诊过该病例的医生姓名+科室（仅统计急诊科及心内科）</div>
            <div>3.按月统计</div>
            <div>查询筛选：</div>
            <div>时间、全院、科室</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div id="d2b-cases-sort" class="dignosis-content" />
      </el-card>
      <el-card v-show="!doc" class="box-card">
        <div slot="header" class="clearfix">
          <span>自行来院D2B耗时最长病例（TOP5）</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>自行来院施行PCI手术的STEMI病例</div>
            <div>数据取值：</div>
            <div>1.入门至导丝通过时间最长耗时5个病例的排名，从长到短</div>
            <div>2.显示接诊过该病例的医生姓名+科室（仅统计急诊科及心内科）</div>
            <div>3.按月统计</div>
            <div>查询筛选：</div>
            <div>时间、全院、科室</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div id="d2b-cases-long" class="dignosis-content" />
      </el-card>
      <el-card v-show="!doc" class="box-card">
        <div slot="header" class="clearfix">
          <span>绕行病例D2B平均时间排名</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>绕行急诊和CCU施行PCI手术的STEMI病例</div>
            <div>数据取值：</div>
            <div>1.入门至导丝通过时间的平均值</div>
            <div>2.按月统计，1个病例计1例，无重复计算</div>
            <div>查询筛选：</div>
            <div>时间、全院、科室</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div id="detour-average-time" class="dignosis-content" />
      </el-card>
      <el-card v-show="!doc" class="box-card">
        <div slot="header" class="clearfix">
          <span>绕行D2B耗时最短病例（TOP5）</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>绕行急诊和CCU施行PCI手术的STEMI病例</div>
            <div>数据取值：</div>
            <div>1.入门至导丝通过时间最短耗时5个病例的排名，从短到长</div>
            <div>2.显示接诊过该病例的医生姓名+科室（仅统计急诊科及心内科3个科室）</div>
            <div>3.按月统计</div>
            <div>查询筛选：</div>
            <div>时间、全院、科室</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div id="detour-cases-sort" class="dignosis-content" />
      </el-card>
      <el-card v-show="!doc" class="box-card">
        <div slot="header" class="clearfix">
          <span>绕行D2B耗时最长病例（TOP5）</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>绕行急诊和CCU施行PCI手术的STEMI病例</div>
            <div>数据取值：</div>
            <div>1.入门至导丝通过时间最长耗时5个病例的排名，从长到短</div>
            <div>2.显示接诊过该病例的医生姓名+科室（仅统计急诊科及心内科3个科室）</div>
            <div>3.按月统计</div>
            <div>查询筛选：</div>
            <div>时间、全院、科室</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div id="detour-cases-long" class="dignosis-content" />
      </el-card>
      <el-card class="box-card">
        <div slot="header" class="clearfix">
          <span>异常（超标/不达标）指标列表</span>
          <el-popover
            placement="bottom"
            title="说明"
            width="400"
            trigger="hover"
            style="margin-left: 5px;"
          >
            <div>考核对象：</div>
            <div>所有胸痛病例</div>
            <div>数据取值：</div>
            <div>1.指标结果属于异常（超标/不达标）的数据</div>
            <div>2.预警时间为该异常值产生的时间。例如指标为一个时间差值，计算方式为A-B，当填写完后一个值的时候系统才能进行计算，异常值在此时产生，该时间即系统预警时间</div>
            <div>查询筛选：</div>
            <div>不支持，默认显示所有异常</div>
            <i slot="reference" class="el-icon-info" style="color: #42cece;" />
          </el-popover>
        </div>
        <div class="dignosis-content">
          <el-table
            :data="tableData"
            height="500px"
            border
            style="width: 100%"
          >
            <el-table-column type="index" align="center" label="序号" width="80" />
            <el-table-column prop="patientName" align="center" label="患者姓名" />
            <el-table-column prop="inpatientNo" align="center" label="住院ID" />
            <el-table-column prop="abnormalTime" align="center" label="预警时间" />
            <el-table-column prop="deptName" align="center" label="科室" />
            <el-table-column prop="doctorName" align="center" label="医生" />
            <el-table-column prop="abTypeName" align="center" label="异常指标概述" />
            <el-table-column prop="abnormalValue" align="center" label="异常值" />
            <el-table-column prop="state" align="center" label="忽略状态">
              <template slot-scope="scope">
                {{ scope.row.state == 1 ? '异常' : scope.row.state == 2 ? '忽略异常' : '' }}
              </template>
            </el-table-column>
            <el-table-column align="center" label="操作">
              <template slot-scope="scope">
                <el-button type="text" @click="view(scope.row)">查看</el-button>
                <el-button type="text" @click="ignore(scope.row)">忽略</el-button>
              </template>
            </el-table-column>
          </el-table>
        </div>
      </el-card>
    </div>
  </div>
</template>

<script>
import echarts from 'echarts'
import {
  getDeptList,
  getDeptUserList,
  getDiagMain,
  getDiagOther,
  getDiagDeptDoctorList,
  getThromNumList,
  getDeptThromNumList,
  getPCIOpNumList,
  getDeptPCIOpNumList,
  getDeptAvgD2BRanking,
  getDirectDeptAvgD2BRanking,
  getAbnormalList,
  ignoreAbnormal,
  getD2BRanking
} from '@/api/statistical/chest-pain'
export default {
  props: ['preYear', 'preQuarter', 'preMonth', 'preMonthRange'],
  data() {
    const _this = this
    return {
      isShowDept: false,
      radioDate: '1',
      year: '',
      quarter: '',
      month: '',
      dept: '',
      doc: '',
      monthRange: [],
      pickerOptions: {
        disabledDate: time => {
          let year = ''
          if (_this.year) {
            year = _this.year
          } else {
            year = time.getFullYear()
          }
          const firstMonth = new Date(+year, 1)
          const lastMonth = new Date(+year, 1)
          if (_this.quarter) {
            if (_this.quarter === 1) {
              firstMonth.setMonth(0)
              lastMonth.setMonth(2)
            } else if (_this.quarter === 2) {
              firstMonth.setMonth(3)
              lastMonth.setMonth(5)
            } else if (_this.quarter === 3) {
              firstMonth.setMonth(6)
              lastMonth.setMonth(8)
            } else if (_this.quarter === 4) {
              firstMonth.setMonth(9)
              lastMonth.setMonth(11)
            }
          } else {
            firstMonth.setMonth(0)
            lastMonth.setMonth(11)
          }
          return time.getTime() < new Date(firstMonth).getTime() || time.getTime() > new Date(lastMonth).getTime()
        }
      },
      deptList: [],
      docList: [],
      tableData: [],
      thrombolysisCasesTotal: 0,
      thrombolysisDistributionTotal: 0,
      pciOperationsTotal: 0,
      surgicalTreatmentTotal: 0
    }
  },
  mounted() {
    // this.getDept()
    // this.getDiagnosis()
    // this.getOtherDiagnosis()
    // this.getThrombolysisCases()
    // this.getThrombolysisDistribution()
    // this.getPciOperations()
    // this.getSurgicalTreatment()
    // this.getD2BAverageTime()
    // this.getD2BCasesSort()
    // this.getD2BCasesLong()
    // this.getDetourAverageTime()
    // this.getDetourCasesSort()
    // this.getDetourCasesLong()
    // this.getTableData()
  },
  methods: {
    search() {
      this.year = this.preYear
      this.quarter = this.preQuarter
      this.month = this.preMonth
      this.monthRange = this.preMonthRange
      this.dept = this.preDept
      this.doc = this.preDoc
      this.isShowDept = false
      if (this.dept || this.doc) {
        this.isShowDept = true
        if (this.isShowDept) {
          this.$nextTick(() => {
            this.getDeptAdmissions()
          })
        }
      }
      this.getDiagnosis()
      this.getOtherDiagnosis()
      this.getThrombolysisCases()
      this.getThrombolysisDistribution()
      this.getPciOperations()
      this.getSurgicalTreatment()
      this.getD2BAverageTime()
      this.getD2BCasesSort()
      this.getD2BCasesLong()
      this.getDetourAverageTime()
      this.getDetourCasesSort()
      this.getDetourCasesLong()
    },
    reset() {
      this.search()
    },
    changeDate(val) {
      if (val === 1) {
        this.monthRange = []
      } else if (val === 2) {
        this.year = ''
        this.quarter = ''
        this.month = ''
      }
    },
    getDept() {
      this.deptList = []
      getDeptList({
        hospitalId: this.$store.getters.hospitalId
      }).then(res => {
        if (res.code === 0) {
          if (res.data) {
            if (res.data.deptList && res.data.deptList.length > 0) {
              this.deptList = res.data.deptList
            }
          }
        }
      })
    },
    deptChange(val) {
      this.doc = ''
      this.docList = []
      getDeptUserList({
        hospitalId: this.$store.getters.hospitalId,
        departmentName: val
      }).then(res => {
        if (res.code === 0) {
          if (res.data) {
            if (res.data.deptUserList && res.data.deptUserList.length > 0) {
              this.docList = res.data.deptUserList
            }
          }
        }
      })
    },
    getDiagnosis() {
      const diagnosisType = document.getElementById('diagnosis-type')
      const myChart = echarts.init(diagnosisType)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getDiagMain({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          let diagMain = []
          if (res.data) {
            let stemiValue = 0
            let nstemiValue = 0
            let uaValue = 0
            let adValue = 0
            let peValue = 0
            let otherValue = 0
            let unknownValue = 0
            if (res.data.diagMainCount) {
              // let sumTotal = Number(stemiValue) + Number(nstemiValue) + Number(uaValue) + Number(adValue) + Number(peValue) + Number(otherValue) + Number(unknownValue)
              stemiValue = res.data.diagMainCount.diagSTEMI ? res.data.diagMainCount.diagSTEMI : 0
              nstemiValue = res.data.diagMainCount.diagNSTEMI ? res.data.diagMainCount.diagNSTEMI : 0
              uaValue = res.data.diagMainCount.diagUA ? res.data.diagMainCount.diagUA : 0
              adValue = res.data.diagMainCount.diagAD ? res.data.diagMainCount.diagAD : 0
              peValue = res.data.diagMainCount.diagPE ? res.data.diagMainCount.diagPE : 0
              otherValue = res.data.diagMainCount.diagOther ? res.data.diagMainCount.diagOther : 0
              unknownValue = res.data.diagMainCount.diagUnknown ? res.data.diagMainCount.diagUnknown : 0
              if (res.data.diagMainPercentage) {
                const stemiRate = res.data.diagMainPercentage.diagSTEMI ? res.data.diagMainPercentage.diagSTEMI : 0
                const nstemiRate = res.data.diagMainPercentage.diagNSTEMI ? res.data.diagMainPercentage.diagNSTEMI : 0
                const uaRate = res.data.diagMainPercentage.diagUA ? res.data.diagMainPercentage.diagUA : 0
                const adRate = res.data.diagMainPercentage.diagAD ? res.data.diagMainPercentage.diagAD : 0
                const peRate = res.data.diagMainPercentage.diagPE ? res.data.diagMainPercentage.diagPE : 0
                const otherRate = res.data.diagMainPercentage.diagOther ? res.data.diagMainPercentage.diagOther : 0
                const unknownRate = res.data.diagMainPercentage.diagUnknown ? res.data.diagMainPercentage.diagUnknown : 0
                diagMain = [
                  { value: stemiValue, name: 'STEMI', rate: stemiRate },
                  { value: nstemiValue, name: 'NSTEMI', rate: nstemiRate },
                  { value: uaValue, name: 'UA', rate: uaRate },
                  { value: adValue, name: '主动脉夹层', rate: adRate },
                  { value: peValue, name: '肺动脉栓塞', rate: peRate },
                  { value: otherValue, name: '其他', rate: otherRate },
                  { value: unknownValue, name: '未知', rate: unknownRate }
                ]
              }
              const option = {
                colors: ['027DB4', 'F59A23', 'EC808D', '02A7F0', '81D3F8', '1557A4', '#1557a435'],
                title: {
                  text: '诊断类型分布情况',
                  subtext: '总计：' + (res.data.total ? res.data.total : 0) + '例',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'item'
                },
                legend: {
                  orient: 'vertical',
                  right: 0,
                  formatter: name => {
                    const nameList = diagMain.filter(item => {
                      return item.name === name
                    })
                    return nameList[0].name + '：' + nameList[0].value + '例' + ' ' + nameList[0].rate + '%'
                  }

                },
                series: [
                  {
                    // name: 'Access From',
                    type: 'pie',
                    radius: '75%',
                    data: diagMain,
                    emphasis: {
                      itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                      }
                    }
                  }
                ]
              }
              myChart.setOption(option)
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getOtherDiagnosis() {
      const diagnosisType = document.getElementById('other-diagnosis-type')
      const myChart = echarts.init(diagnosisType)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getDiagOther({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          let diagOther = []
          if (res.data) {
            let nacsValue = 0
            let otherValue = 0
            let awaitCPValue = 0
            let awaitCTValue = 0
            let undefinedValue = 0

            let nacsRate = 0
            let otherRate = 0
            let awaitCPRate = 0
            let awaitCTRate = 0
            let undefinedRate = 0
            if (res.data.diagOtherPercentage) {
              nacsRate = res.data.diagOtherPercentage.diagNACS ? res.data.diagOtherPercentage.diagNACS : 0
              otherRate = res.data.diagOtherPercentage.diagOther ? res.data.diagOtherPercentage.diagOther : 0
              awaitCPRate = res.data.diagOtherPercentage.diagAwaitCP ? res.data.diagOtherPercentage.diagAwaitCP : 0
              awaitCTRate = res.data.diagOtherPercentage.diagAwaitCT ? res.data.diagOtherPercentage.diagAwaitCT : 0
              undefinedRate = res.data.diagOtherPercentage.diagUndefined ? res.data.diagOtherPercentage.diagUndefined : 0
            }
            if (res.data.diagOtherCount) {
              nacsValue = res.data.diagOtherCount.diagNACS ? res.data.diagOtherCount.diagNACS : 0
              otherValue = res.data.diagOtherCount.diagOther ? res.data.diagOtherCount.diagOther : 0
              awaitCPValue = res.data.diagOtherCount.diagAwaitCP ? res.data.diagOtherCount.diagAwaitCP : 0
              awaitCTValue = res.data.diagOtherCount.diagAwaitCT ? res.data.diagOtherCount.diagAwaitCT : 0
              undefinedValue = res.data.diagOtherCount.diagUndefined ? res.data.diagOtherCount.diagUndefined : 0
              diagOther = [
                { value: nacsValue, name: '非ACS心源性胸痛', rate: nacsRate },
                { value: otherValue, name: '其它非心源性胸痛', rate: otherRate },
                { value: awaitCPValue, name: '胸痛待查', rate: awaitCPRate },
                { value: awaitCTValue, name: '胸闷待查', rate: awaitCTRate },
                { value: undefinedValue, name: '未明确诊断', rate: undefinedRate }
              ]
              const option = {
                colors: ['027DB4', 'F59A23', 'EC808D', '02A7F0', 'A19055'],
                title: {
                  text: '其他诊断类型分布情况',
                  subtext: '总计：' + (res.data.total ? res.data.total : 0) + '例',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'item'
                },
                legend: {
                  orient: 'vertical',
                  right: 0,
                  formatter: name => {
                    const nameList = diagOther.filter(item => {
                      return item.name === name
                    })
                    return nameList[0].name + '：' + nameList[0].value + '例' + ' ' + nameList[0].rate + '%'
                  }
                },
                series: [
                  {
                    // name: 'Access From',
                    type: 'pie',
                    radius: '50%',
                    data: diagOther,
                    emphasis: {
                      itemStyle: {
                        shadowBlur: 10,
                        shadowOffsetX: 0,
                        shadowColor: 'rgba(0, 0, 0, 0.5)'
                      }
                    }
                  }
                ]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getDeptAdmissions() {
      const diagnosisType = document.getElementById('dept-admissions')
      const myChart = echarts.init(diagnosisType)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getDiagDeptDoctorList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          if (res.data) {
            const stemiArr = []
            const nstemiArr = []
            const uaArr = []
            const adArr = []
            const peArr = []
            const otherArr = []
            const unknownArr = []
            const timeline = []
            let legendArr = []
            let stemiValue = 0
            let nstemiValue = 0
            let uaValue = 0
            let adValue = 0
            let peValue = 0
            let otherValue = 0
            let unknownValue = 0
            let stemiRate = 0
            let nstemiRate = 0
            let uaRate = 0
            let adRate = 0
            let peRate = 0
            let otherRate = 0
            let acsValue = 0
            let acsRate = 0
            let unknownRate = 0
            if (res.data.diagDeptSubTotal) {
              stemiValue = res.data.diagDeptSubTotal.diagSTEMI ? res.data.diagDeptSubTotal.diagSTEMI : 0
              nstemiValue = res.data.diagDeptSubTotal.diagNSTEMI ? res.data.diagDeptSubTotal.diagNSTEMI : 0
              uaValue = res.data.diagDeptSubTotal.diagUA ? res.data.diagDeptSubTotal.diagUA : 0
              adValue = res.data.diagDeptSubTotal.diagAD ? res.data.diagDeptSubTotal.diagAD : 0
              peValue = res.data.diagDeptSubTotal.diagPE ? res.data.diagDeptSubTotal.diagPE : 0
              otherValue = res.data.diagDeptSubTotal.diagOther ? res.data.diagDeptSubTotal.diagOther : 0
              unknownValue = res.data.diagDeptSubTotal.diagUnknown ? res.data.diagDeptSubTotal.diagUnknown : 0
            }
            acsValue = Number(stemiValue) + Number(nstemiValue) + Number(uaValue)
            if (res.data.diagDeptPercentage) {
              stemiRate = res.data.diagDeptPercentage.diagSTEMI ? res.data.diagDeptPercentage.diagSTEMI : 0
              nstemiRate = res.data.diagDeptPercentage.diagNSTEMI ? res.data.diagDeptPercentage.diagNSTEMI : 0
              uaRate = res.data.diagDeptPercentage.diagUA ? res.data.diagDeptPercentage.diagUA : 0
              adRate = res.data.diagDeptPercentage.diagAD ? res.data.diagDeptPercentage.diagAD : 0
              peRate = res.data.diagDeptPercentage.diagPE ? res.data.diagDeptPercentage.diagPE : 0
              otherRate = res.data.diagDeptPercentage.diagOther ? res.data.diagDeptPercentage.diagOther : 0
              unknownRate = res.data.diagDeptPercentage.diagUnknown ? res.data.diagDeptPercentage.diagUnknown : 0
            }
            acsRate = Number(stemiRate) + Number(nstemiRate) + Number(uaRate)
            legendArr = [{
              name: 'STEMI',
              value: stemiValue,
              rate: stemiRate
            }, {
              name: 'NSTEMI',
              value: nstemiValue,
              rate: nstemiRate
            }, {
              name: 'UA',
              value: uaValue,
              rate: uaRate
            }, {
              name: '主动脉夹层',
              value: adValue,
              rate: adRate
            }, {
              name: '肺动脉栓塞',
              value: peValue,
              rate: peRate
            }, {
              name: '其他',
              value: otherValue,
              rate: otherRate
            }, {
              name: '未知',
              value: unknownValue,
              rate: unknownRate
            }]
            if (res.data.diagDeptCountList && res.data.diagDeptCountList.length > 0) {
              res.data.diagDeptCountList.forEach(el => {
                stemiArr.push(el.diagSTEMI ? el.diagSTEMI : 0)
                nstemiArr.push(el.diagNSTEMI ? el.diagNSTEMI : 0)
                uaArr.push(el.diagUA ? el.diagUA : 0)
                adArr.push(el.diagAD ? el.diagAD : 0)
                peArr.push(el.diagPE ? el.diagPE : 0)
                otherArr.push(el.diagOther ? el.diagOther : 0)
                unknownArr.push(el.diagUnknown ? el.diagUnknown : 0)
                const timeDate = el.year + '-' + el.month
                timeline.push(timeDate)
              })
              const option = {
                color: ['#027DB4', '#F59A23', '#E2596A', '#7B4D12', '#81D3F8', '#027db49b'],
                title: {
                  text: '总计：' + (res.data.total ? res.data.total : 0) + '例',
                  subtext: 'ACS病例小计: ' + acsValue + '例 ' + ' ' + acsRate + '%',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                grid: {
                  top: 100,
                  bottom: 30
                },
                legend: {
                  // orient: 'vertical',
                  // right: 0,
                  top: '50px',
                  formatter: name => {
                    const legendData = legendArr.filter(item => {
                      return item.name === name
                    })
                    return legendData[0].name + '：' + legendData[0].value + '例' + ' ' + legendData[0].rate + '%'
                  }
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeline
                },
                yAxis: {
                  name: '例',
                  type: 'value'
                },
                series: [{
                  name: 'STEMI',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: stemiArr
                }, {
                  name: 'NSTEMI',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: nstemiArr
                }, {
                  name: 'UA',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: uaArr
                }, {
                  name: '主动脉夹层',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: adArr
                }, {
                  name: '肺动脉栓塞',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: peArr
                }, {
                  name: '其他',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: otherArr
                }, {
                  name: '未知',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: unknownArr
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        }
      })
    },
    getThrombolysisCases() {
      const diagnosisType = document.getElementById('thrombolysis-cases')
      const myChart = echarts.init(diagnosisType)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getThromNumList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          const timeLine = []
          const thromList = []
          const preThromList = []
          if (res.data) {
            this.thrombolysisCasesTotal = res.data.totalAll ? res.data.totalAll : 0
            if (res.data.thromNumList && res.data.thromNumList.length > 0) {
              res.data.thromNumList.forEach(el => {
                const timeData = el.year + '-' + el.month
                timeLine.push(timeData)
                thromList.push(el.thromNum ? el.thromNum : 0)
                preThromList.push(el.preThromNum ? el.preThromNum : 0)
              })
              const option = {
                color: ['#027DB4', '#F59A23'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  top: '20px',
                  formatter: name => {
                    if (name == '院内') {
                      return name + '：' + (res.data.total ? res.data.total : 0) + '例'
                    }
                    if (name == '院前') {
                      return name + '：' + (res.data.totalPre ? res.data.totalPre : 0) + '例'
                    }
                  }
                },
                grid: {
                  top: 60
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '例',
                  type: 'value'
                },
                series: [{
                  name: '院内',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: thromList
                }, {
                  name: '院前',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: preThromList
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getThrombolysisDistribution() {
      const diagnosisType = document.getElementById('thrombolysis-distribution')
      const myChart = echarts.init(diagnosisType)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getDeptThromNumList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            this.thrombolysisDistributionTotal = res.data.total ? res.data.total : 0
            if (res.data.deptThromNumList && res.data.deptThromNumList.length > 0) {
              const thromList = []
              const timeLine = []
              res.data.deptThromNumList.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : '')
                thromList.push(el.thromNum ? el.thromNum : 0)
              })
              const option = {
                color: ['#027DB4'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  top: '20px',
                  formatter: function(name) {
                    const legendTitle = '总数：' + (res.data.total ? res.data.total : 0) + '例'
                    return legendTitle
                  }
                },
                grid: {
                  top: 60
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '例',
                  type: 'value'
                },
                series: [{
                  name: '总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: thromList
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getPciOperations() {
      const diagnosisType = document.getElementById('pci-operations')
      const myChart = echarts.init(diagnosisType)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getPCIOpNumList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            this.pciOperationsTotal = res.data.total ? res.data.total : 0
            const timeLine = []
            const stentImplantationList = []
            const ptcaList = []
            const intracoronaryThromList = []
            const thrombusAspirationList = []
            let stentValue = 0
            let ptcaValue = 0
            let intracoronaryValue = 0
            let thromValue = 0
            let stentRate = 0
            let ptcaRate = 0
            let intracoronaryRate = 0
            let thromRate = 0
            let legendList = []
            if (res.data.pciOpSubTotal) {
              stentValue = res.data.pciOpSubTotal.numStentImplantation ? res.data.pciOpSubTotal.numStentImplantation : 0
              ptcaValue = res.data.pciOpSubTotal.numPTCA ? res.data.pciOpSubTotal.numPTCA : 0
              intracoronaryValue = res.data.pciOpSubTotal.numIntracoronaryThrom ? res.data.pciOpSubTotal.numIntracoronaryThrom : 0
              thromValue = res.data.pciOpSubTotal.numThrombusAspiration ? res.data.pciOpSubTotal.numThrombusAspiration : 0
            }
            if (res.data.pciOpPercentage) {
              stentRate = res.data.pciOpPercentage.numStentImplantation ? res.data.pciOpPercentage.numStentImplantation : 0
              ptcaRate = res.data.pciOpPercentage.numPTCA ? res.data.pciOpPercentage.numPTCA : 0
              intracoronaryRate = res.data.pciOpPercentage.numIntracoronaryThrom ? res.data.pciOpPercentage.numIntracoronaryThrom : 0
              thromRate = res.data.pciOpPercentage.numThrombusAspiration ? res.data.pciOpPercentage.numThrombusAspiration : 0
            }
            legendList = [{
              name: '植入支架',
              value: stentValue,
              rate: stentRate
            }, {
              name: 'PTCA',
              value: ptcaValue,
              rate: ptcaRate
            }, {
              name: '冠脉内溶栓',
              value: intracoronaryValue,
              rate: intracoronaryRate
            }, {
              name: '血栓抽吸',
              value: thromValue,
              rate: thromRate
            }]
            if (res.data.pciOpNumList && res.data.pciOpNumList.length > 0) {
              res.data.pciOpNumList.forEach(el => {
                const timeData = el.year + '-' + el.month
                timeLine.push(timeData)
                stentImplantationList.push(el.numStentImplantation ? el.numStentImplantation : 0)
                ptcaList.push(el.numPTCA ? el.numPTCA : 0)
                intracoronaryThromList.push(el.numIntracoronaryThrom ? el.numIntracoronaryThrom : 0)
                thrombusAspirationList.push(el.numThrombusAspiration ? el.numThrombusAspiration : 0)
              })
              const option = {
                color: ['#027DB4', '#F59A23', '#E2596A', '#5EAFAF'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  // orient: 'vertical',
                  // right: 0,
                  top: '20px',
                  formatter: name => {
                    const legendData = legendList.filter(item => {
                      return item.name === name
                    })
                    return legendData[0].name + '：' + legendData[0].value + '例' + ' ' + legendData[0].rate + '%'
                  }
                },
                grid: {
                  top: 60
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '例',
                  type: 'value'
                },
                series: [{
                  name: '植入支架',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: stentImplantationList
                }, {
                  name: 'PTCA',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: ptcaList
                }, {
                  name: '冠脉内溶栓',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: intracoronaryThromList
                }, {
                  name: '血栓抽吸',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: thrombusAspirationList
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getSurgicalTreatment() {
      const diagnosisType = document.getElementById('surgical-treatment')
      const myChart = echarts.init(diagnosisType)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getDeptPCIOpNumList({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code === 0) {
          if (res.data) {
            this.surgicalTreatmentTotal = res.data.total ? res.data.total : 0
            const timeLine = []
            const stentImplantationList = []
            const ptcaList = []
            const intracoronaryThromList = []
            const thrombusAspirationList = []
            let stentValue = 0
            let ptcaValue = 0
            let intracoronaryValue = 0
            let thromValue = 0
            let stentRate = 0
            let ptcaRate = 0
            let intracoronaryRate = 0
            let thromRate = 0
            let legendList = []
            if (res.data.pciOpSubTotal) {
              stentValue = res.data.pciOpSubTotal.numStentImplantation ? res.data.pciOpSubTotal.numStentImplantation : 0
              ptcaValue = res.data.pciOpSubTotal.numPTCA ? res.data.pciOpSubTotal.numPTCA : 0
              intracoronaryValue = res.data.pciOpSubTotal.numIntracoronaryThrom ? res.data.pciOpSubTotal.numIntracoronaryThrom : 0
              thromValue = res.data.pciOpSubTotal.numThrombusAspiration ? res.data.pciOpSubTotal.numThrombusAspiration : 0
            }
            if (res.data.pciOpPercentage) {
              stentRate = res.data.pciOpPercentage.numStentImplantation ? res.data.pciOpPercentage.numStentImplantation : 0
              ptcaRate = res.data.pciOpPercentage.numPTCA ? res.data.pciOpPercentage.numPTCA : 0
              intracoronaryRate = res.data.pciOpPercentage.numIntracoronaryThrom ? res.data.pciOpPercentage.numIntracoronaryThrom : 0
              thromRate = res.data.pciOpPercentage.numThrombusAspiration ? res.data.pciOpPercentage.numThrombusAspiration : 0
            }
            legendList = [{
              name: '植入支架',
              value: stentValue,
              rate: stentRate
            }, {
              name: 'PTCA',
              value: ptcaValue,
              rate: ptcaRate
            }, {
              name: '冠脉内溶栓',
              value: intracoronaryValue,
              rate: intracoronaryRate
            }, {
              name: '血栓抽吸',
              value: thromValue,
              rate: thromRate
            }]
            if (res.data.deptPCIOpNumList && res.data.deptPCIOpNumList.length > 0) {
              res.data.deptPCIOpNumList.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : 0)
                stentImplantationList.push(el.numStentImplantation ? el.numStentImplantation : 0)
                ptcaList.push(el.numPTCA ? el.numPTCA : 0)
                intracoronaryThromList.push(el.numIntracoronaryThrom ? el.numIntracoronaryThrom : 0)
                thrombusAspirationList.push(el.numThrombusAspiration ? el.numThrombusAspiration : 0)
              })
              const option = {
                color: ['#027DB4', '#F59A23', '#E2596A', '#5EAFAF'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  top: '20px',
                  formatter: name => {
                    const legendData = legendList.filter(item => {
                      return item.name == name
                    })
                    if (legendData.length > 0) {
                      return legendData[0].name + '：' + legendData[0].value + '例' + ' ' + legendData[0].rate + '%'
                    }
                  }
                },
                grid: {
                  top: 60
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '例',
                  type: 'value'
                },
                dataZoom: [{
                  xAxisIndex: 0,
                  show: true,
                  type: 'slider',
                  startValue: 0,
                  endValue: 7,
                  height: 10
                }],
                series: [{
                  name: '植入支架',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: stentImplantationList
                }, {
                  name: 'PTCA',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: ptcaList
                }, {
                  name: '冠脉内溶栓',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: intracoronaryThromList
                }, {
                  name: '血栓抽吸',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: thrombusAspirationList
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getD2BAverageTime() {
      const d2bAverageTime = document.getElementById('d2b-average-time')
      const myChart = echarts.init(d2bAverageTime)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getDeptAvgD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const d2bData = []
            if (res.data.deptAvgD2BRanking && res.data.deptAvgD2BRanking.length > 0) {
              res.data.deptAvgD2BRanking.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : '')
                d2bData.push(el.avgD2B ? el.avgD2B : 0)
              })
              const option = {
                color: ['#027DB4'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  show: false
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '分钟',
                  type: 'value'
                },
                series: [{
                  name: '总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: d2bData
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getD2BCasesSort() {
      const d2bCasesSort = document.getElementById('d2b-cases-sort')
      const myChart = echarts.init(d2bCasesSort)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'shortest',
        isDirect: 0
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })
              const option = {
                color: ['#027DB4'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  show: false,
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  show: false
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '分钟',
                  type: 'value'
                },
                series: [{
                  name: '总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    borderColor: '#e5e5e5',
                    borderWidth: '1px',
                    borderDashOffset: 2,
                    backgroundColor: '#fff',
                    borderRadius: '4px',
                    padding: 5,
                    formatter: params => {
                      let labelArr = []
                      labelArr = labelList.filter(item => {
                        return item.name == params.name
                      })
                      return labelArr[0].doctorList.join('\n')
                    },
                    rich: {
                      a: {
                        fontSize: '24px'
                      },
                      b: {
                        fontSize: '16px',
                        color: '#000'
                      },
                      x: {
                        border: '1px solid #e5e5e5'
                      }
                    },
                    position: 'right'
                  },
                  data: docData
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getD2BCasesLong() {
      const d2bCasesLong = document.getElementById('d2b-cases-long')
      const myChart = echarts.init(d2bCasesLong)
      myChart.clear()
      myChart.showLoading({
        text: '',
        fontSize: 18,
        left: 'center',
        color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
        textColor: '#fff', // 文字颜色
        maskColor: 'rgba(255, 255, 255, 0)' // 背景色
      })
      window.addEventListener('resize', myChart.resize)
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'longest',
        isDirect: 0
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })
              const option = {
                color: ['#027DB4'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  show: false,
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  show: false,
                  left: 'right'
                  // formatter: name => {
                  //   console.log(name, 'name')
                  // }
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '分钟',
                  type: 'value'
                },
                series: [{
                  name: '总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    borderColor: '#e5e5e5',
                    borderWidth: '1px',
                    borderDashOffset: 2,
                    backgroundColor: '#fff',
                    borderRadius: '4px',
                    padding: 5,
                    formatter: params => {
                      let labelArr = []
                      labelArr = labelList.filter(item => {
                        return item.name == params.name
                      })
                      return labelArr[0].doctorList.join('\n')
                    },
                    rich: {
                      a: {
                        fontSize: '24px'
                      },
                      b: {
                        fontSize: '16px',
                        color: '#000'
                      },
                      x: {
                        border: '1px solid #e5e5e5'
                      }
                    },
                    position: 'right'
                  },
                  data: docData
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getDetourAverageTime() {
      const detourAverageTime = document.getElementById('detour-average-time')
      const myChart = echarts.init(detourAverageTime)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getDirectDeptAvgD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const directData = []
            if (res.data.directDeptAvgD2BRanking && res.data.directDeptAvgD2BRanking.length > 0) {
              res.data.directDeptAvgD2BRanking.forEach(el => {
                timeLine.push(el.departmentName ? el.departmentName : '')
                directData.push(el.avgD2B ? el.avgD2B : 0)
              })
              const option = {
                color: ['#027DB4'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  show: false
                  // left: 'right'
                  // formatter: name => {
                  //   console.log(name, 'name')
                  // }
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '分钟',
                  type: 'value'
                },
                series: [{
                  name: '总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    position: 'top'
                  },
                  data: directData
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getDetourCasesSort() {
      const detourCasesSort = document.getElementById('detour-cases-sort')
      const myChart = echarts.init(detourCasesSort)
      myChart.clear()
      myChart.hideLoading()
      window.addEventListener('resize', myChart.resize)
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'shortest',
        isDirect: 1
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })
              const option = {
                color: ['#027DB4'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  show: false,
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  show: false
                  // left: 'right'
                  // formatter: name => {
                  //   console.log(name, 'name')
                  // }
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '分钟',
                  type: 'value'
                },
                series: [{
                  name: '总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    borderColor: '#e5e5e5',
                    borderWidth: '1px',
                    borderDashOffset: 2,
                    backgroundColor: '#fff',
                    borderRadius: '4px',
                    padding: 5,
                    formatter: params => {
                      let labelArr = []
                      labelArr = labelList.filter(item => {
                        return item.name == params.name
                      })
                      return labelArr[0].doctorList.join('\n')
                    },
                    rich: {
                      a: {
                        fontSize: '24px'
                      },
                      b: {
                        fontSize: '16px',
                        color: '#000'
                      },
                      x: {
                        border: '1px solid #e5e5e5'
                      }
                    },
                    position: 'right'
                  },
                  data: docData
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getDetourCasesLong() {
      const detourCasesLong = document.getElementById('detour-cases-long')
      const myChart = echarts.init(detourCasesLong)
      myChart.clear()
      myChart.showLoading({
        text: '',
        fontSize: 18,
        left: 'center',
        color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
        textColor: '#fff', // 文字颜色
        maskColor: 'rgba(255, 255, 255, 0)' // 背景色
      })
      window.addEventListener('resize', myChart.resize)
      getD2BRanking({
        hospitalId: this.$store.getters.hospitalId,
        year: this.year,
        quarter: this.quarter,
        month: this.month,
        startTime: this.monthRange.length > 0 ? this.monthRange[0] : '',
        endTime: this.monthRange.length > 0 ? this.monthRange[1] : '',
        departmentName: this.dept,
        doctorName: this.doc,
        type: 'longest',
        isDirect: 1
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            const timeLine = []
            const docData = []
            const labelList = []
            if (res.data.d2bRanking && res.data.d2bRanking.length > 0) {
              res.data.d2bRanking.forEach(el => {
                timeLine.push(el.patientName ? el.patientName : '')
                docData.push(el.D2B ? el.D2B : 0)
                const docArr = []
                const d2bStr = '{a|' + (el.D2B ? el.D2B : 0) + '分钟}'
                docArr.push(d2bStr)
                if (el.doctorList && el.doctorList.length > 0) {
                  el.doctorList.forEach(docEl => {
                    const docStr = '{b|' + docEl + '}'
                    docArr.push(docStr)
                  })
                }
                labelList.push({
                  name: el.patientName ? el.patientName : '',
                  value: el.D2B ? el.D2B : 0,
                  doctorList: docArr
                })
              })
              const option = {
                color: ['#027DB4'],
                title: {
                  text: '',
                  subtext: '',
                  left: 'center'
                },
                tooltip: {
                  show: false,
                  trigger: 'axis',
                  axisPointer: {
                    type: 'shadow'
                  }
                },
                legend: {
                  show: false,
                  left: 'right'
                  // formatter: name => {
                  //   console.log(name, 'name')
                  // }
                },
                xAxis: {
                  type: 'category',
                  axisTick: {
                    alignWithLabel: true
                  },
                  data: timeLine
                },
                yAxis: {
                  name: '分钟',
                  type: 'value'
                },
                series: [{
                  name: '总数',
                  type: 'bar',
                  barWidth: 20,
                  label: {
                    show: true,
                    borderColor: '#e5e5e5',
                    borderWidth: '1px',
                    borderDashOffset: 2,
                    backgroundColor: '#fff',
                    borderRadius: '4px',
                    padding: 5,
                    formatter: params => {
                      let labelArr = []
                      labelArr = labelList.filter(item => {
                        return item.name == params.name
                      })
                      if (labelArr.length > 0) {
                        return labelArr[0].doctorList.join('\n')
                      }
                    },
                    rich: {
                      a: {
                        fontSize: '24px'
                      },
                      b: {
                        fontSize: '16px',
                        color: '#000'
                      },
                      x: {
                        border: '1px solid #e5e5e5'
                      }
                    },
                    position: 'right'
                  },
                  data: docData
                }]
              }
              myChart.setOption(option)
            } else {
              myChart.showLoading({
                text: '暂无数据',
                fontSize: 18,
                left: 'center',
                color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
                textColor: '#000', // 文字颜色
                maskColor: 'rgba(255, 255, 255, 0)' // 背景色
              })
            }
          }
        } else {
          myChart.showLoading({
            text: '暂无数据',
            fontSize: 18,
            left: 'center',
            color: 'transparent', // loading颜色，设置成透明或白色，不然会显示loading状态
            textColor: '#000', // 文字颜色
            maskColor: 'rgba(255, 255, 255, 0)' // 背景色
          })
        }
      })
    },
    getTableData() {
      this.tableData = []
      getAbnormalList({
        hospitalId: this.$store.getters.hospitalId
      }).then(res => {
        if (res.code == 0) {
          if (res.data) {
            if (res.data.statisticAbnormalList && res.data.statisticAbnormalList.length > 0) {
              this.tableData = res.data.statisticAbnormalList
            }
          }
        }
      })
    },
    ignore(row) {
      this.$confirm('此操作将忽略该异常患者, 是否继续?', '提示', {
        confirmButtonText: '确定',
        cancelButtonText: '取消',
        type: 'warning'
      }).then(() => {
        const formData = new FormData()
        formData.append('abnormalId', row.id)
        ignoreAbnormal(formData).then(res => {
          if (res.code == 0) {
            this.getTableData()
            this.$message({
              type: 'success',
              message: '忽略该异常患者成功!'
            })
          }
        })
      }).catch(() => {
        this.$message({
          type: 'info',
          message: '已取消忽略'
        })
      })
    },
    view(row) {
      row.abNormal = true
      row.diseaseType = '胸痛'
      row.medicalId = 0
      const rowStr = JSON.stringify(row)
      this.$router.push({
        name: 'patientsList',
        params: {
          rowStr: rowStr
        }
      })
    }
  }
}
</script>
